package com.game.doudizhu.controller;

import com.game.doudizhu.model.PlayerRank;
import com.game.doudizhu.service.RankingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Api(tags = "排行榜接口", description = "提供游戏排行榜相关的所有操作")
@Controller
@RequestMapping("/api/stats/rankings")
public class RankingController {

    @Autowired
    private RankingService rankingService;

    @ApiOperation(value = "获取积分排行榜", notes = "获取玩家积分排行榜前100名")
    @GetMapping("/score")
    @ResponseBody
    public List<PlayerRank> getScoreRankings() {
        return rankingService.getScoreRankings();
    }

    @ApiOperation(value = "获取胜率排行榜", notes = "获取玩家胜率排行榜前100名")
    @GetMapping("/winrate")
    @ResponseBody
    public List<PlayerRank> getWinRateRankings() {
        return rankingService.getWinRateRankings();
    }

    @ApiOperation(value = "获取成就排行榜", notes = "获取玩家成就数量排行榜前100名")
    @GetMapping("/achievement")
    @ResponseBody
    public List<PlayerRank> getAchievementRankings() {
        return rankingService.getAchievementRankings();
    }
} 